package cn.joeg.app.web.core.language;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;

import java.util.Locale;

@Configuration
public class EnvConfig {


    @Primary
    @Bean(name = "envLocale")
    @ConfigurationProperties(prefix = "spring.env")
    public Locale dataSource(@Value("${spring.env.lang}") String lang,
                             @Value("${spring.env.country}") String country) {
        return new Locale(lang, country);
    }

}
